import type { Add, areaData, CardDetail, CardListData, CardListParams, CardParams, CarListData, carPayData, CarRuleParams } from "@/types/card"
import { request } from "@/utils/reuqest"

// 获取月卡列表
export const CardAPI=(params:CardListParams)=>{
    return request<CardListData>('/parking/card/list','get',params)
}

// 添加月卡
export const CardAddAPI=(data:Partial<CardParams>)=>{
    return request<Add>('/parking/card','post',data)
}
// 获取月卡详情
export const getCardDetailAPI=(id:string)=>{
    return request<CardDetail>(`/parking/card/detail/${id}`,'get')
}
// 修改月卡
export const EditCardAPI=(data:Partial<CardDetail>)=>{
    return request<Add>('/parking/card/edit','put',data)
}

// 删除月卡
export const deleteCardAPI=(ids:number[])=>{
    return request<Add>(`/parking/card/${ids.join(',')}`,'delete')
}

// 停车计费规则
export const CarRule=(data:CarRuleParams)=>{
    return request<CarListData>('/parking/rule/list','get',data)
}
// 编辑停车计费
export const EditCarRule=(data:CarListData)=>{
    return request('/parking/rule/edit','put',data)
}
export const AreaList=(data:CarRuleParams)=>{
    return request<areaData>('/parking/area/list','get',data)
}
// 停车缴费
export const CarPay=(data:CardListParams)=>{
    return request<carPayData>('/parking/payment/list','get',data)
}